﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="${pageContext.request.contextPath}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<%@ include file="base.jsp" %>
<script src="${pageContext.request.contextPath}/js/jquery.min.js" type="text/javascript"></script>   
<script src="${pageContext.request.contextPath}/js/base.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerGrid.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerForm.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerDateEditor.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerComboBox.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerCheckBox.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerRadio.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerSpinner.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerTextBox.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/inject.js" type="text/javascript"></script> 
<script src="${pageContext.request.contextPath}/js/ligerPopupEdit.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerDialog.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/ligerTip.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery.validate.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/jquery.metadata.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/messages_cn.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/common/ligerUiCommon.js" type="text/javascript"></script>  
<script src="${pageContext.request.contextPath}/js/common/ajax.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/js/common/dateFormateUtil.js" type="text/javascript"></script>
<script type="text/javascript"> 
	//添加校验
	$(function() {
		addValidate(submitData);
		$("form").ligerForm();
	});
	
		//初始化
		$(function() {
			var obj = eval(${rowJsonStringData});
			if("${isReadOnly}") {//查看
				setView("xm", obj.xm);
				setView("qq", obj.qq);
				setView("dh", obj.dh);
				setView("xb", obj.xb);
				setView("nl", obj.nl);
				setView("dz", obj.dz);//更新时间
				setView("bz", obj.bz);//更新时间
				setView("lrsj", formatDate(obj.lrsj, "yyyy-MM-dd HH:mm:ss"));//更新时间
				return;
			}
			//编辑
			if(obj) {
				$("#khId").val(obj.id);
				$("#xm").val(obj.xm);
				$("#qq").val(obj.qq);
				$("#dh").val(obj.dh);
				$("#xb").val(obj.xb);
				$("#nl").val(obj.nl);
				$("#dz").val(obj.dz);
				$("#bz").val(obj.bz);
				$("#lrsj").text(formatDate(obj.lrsj, "yyyy-MM-dd HH:mm:ss"));//录入时间
			} else {
				$("#lrsj").text(formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"));//录入时间
			}
		
	});

	//提交商品信息
	function submitData() {
		
		var dd = {};
		dd.id = $("#khId").val();
		dd.xm = $("#xm").val();
		dd.qq = $("#qq").val();
		dd.dh = $("#dh").val();
		dd.xb = $("#xb").val();
		dd.nl = $("#nl").val() ? $("#nl").val() : 0;
		dd.dz = $("#dz").val();
		dd.bz = $("#bz").val();
		dd.userid = "${user.id}";
		dd.lrsj = $("#lrsj").text();
		
		var url = "${pageContext.request.contextPath}/KhglAction?control=saveKhxx";
		sendAjaxRequest(url, JSON.stringify(dd), false, function(msg) {
			if(msg.data == "保存成功") {
				$.ligerDialog.success("保存成功", "提示", function(){
					//document.getElementById("backup").click();
				});
			} else {
				$.ligerDialog.error(msg.data);
			}
		});
	}
	
	function setView(id, val) {
		var t = document.getElementById(id);
		while(t.tagName != "TD") {
			t = t.parentNode;
		}
		t.innerHTML = val;
	}
	
	//刷新页面
	function clearInput() {
		location.reload();
	}
</script>
<!--[if IE 6]>
   <script src="js/DD_belatedPNG.js"></script>
   <script>DD_belatedPNG.fix('.xxjbb_5 img');</script>
<![endif]-->
<title></title>
</head>
<style type="text/css">
body{background:#ffffff}
html{_overflow-y:scroll;}
</style>
<body>
<div class="xxjbb_position">
<table width="100%" align="left" cellpadding="0" cellspacing="0">
  <tr>
    <td class="xxjbb_1 xxjbb_3">
     <ul>
       <li class="xxjbb_1_block"><a id="backup" href="${pageContext.request.contextPath}/jsp/khgl.jsp"><span><<</span>返回</a></li>
       <li><a href="#" onclick="javascript:$('#khglForm').submit();">保存</a></li>
       <li><a href="#" onclick="clearInput()">重置</a></li>
     </ul>
   </td>
  </tr>
</table>
</div>
<div class="xxjbb_4">
 <form id="khglForm" name="khglForm" method="post" >
  <table width="100%" align="left" cellpadding="0" cellspacing="0" class="bjkcxx">
  <input type="hidden" id="khId" />
      <tr>
        <td class="xxjbb_mc" width="20%"><b>名称</b></td>
        <td class="xxjbb_mccc" width="80%"><b>值</b></td>
      </tr>
      <tr>
        <td class="xxjbb_b">姓名*</td>
        <td class="xxjbb_bbb">
          <table>
            <tr>
              <td><input  id="xm" type="text" validate="{required:true}"/></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="xxjbb_z">QQ号</td>
        <td class="xxjbb_zzz">
          <table>
            <tr>
              <td><input   id="qq" name="qq" type="text" validate="{digits:true}"/></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="xxjbb_b">客户电话*</td>
        <td class="xxjbb_bbb">
          <table>
            <tr>
              <td><input   id="dh" name="dh" type="text" validate="{digits:true}"/></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="xxjbb_z">性别</td>
        <td class="xxjbb_zzz">
          <table>
            <tr>
              <td><select id="xb">
              		<option value="男" selected="selected">男</option>
              		<option value="女">女</option>
              </select></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="xxjbb_b">年龄*</td>
        <td class="xxjbb_bbb">
          <table>
            <tr>
              <td><input   id="nl" name="nl" type="text"  validate="{digits:true}"/></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="xxjbb_z">地址</td>
        <td class="xxjbb_zzz">
          <table>
            <tr>
              <td ><textarea id="dz"></textarea></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="xxjbb_b">备注</td>
        <td class="xxjbb_bbb">
          <table>
            <tr>
              <td ><textarea id="bz"></textarea></td>
            </tr>
          </table>
        </td>
      </tr>
      <tr>
        <td class="xxjbb_z">录入时间</td>
        <td class="xxjbb_zzz">
          <table>
            <tr>
              <td id="lrsj"></td>
            </tr>
          </table>
        </td>
      </tr>
     <!--   <tr>
        <td class="xxjbb_b">附件</td>
        <td class="xxjbb_bbb xxjbb_2 xxjbb_6">
             <ul>
               <li class="xxjbb_1_block"><a href="#">上传</a></li>
             </ul>
        </td>
      </tr> -->
    </table>
    </form>
</div>
<!--  
<div class="xxjbb_8">
 <table width="100%" align="left" cellpadding="0" cellspacing="0" class="bjkcxx" style="margin:10px 0 0 0">
      <tr>
         <td class="xxjbb_mc"><b>文件名</b></td>
         <td class="xxjbb_mc"><b>文件描述</b></td>
         <td class="xxjbb_mc"><b>上传人</b></td>
         <td class="xxjbb_mc"><b>时间</b></td>
         <td class="xxjbb_mccc"><b>操作</b></td>
      </tr>
      <tr>
         <td class="xxjbb_6a">文件名</td>
         <td class="xxjbb_6a">文件描述</td>
         <td class="xxjbb_6a">上传人</td>
         <td class="xxjbb_6a">时间</td>
         <td class="xxjbb_6b"><a href="#">删除</a></td>
      </tr>
    </table>
</div>
-->
</body>
</html>
